/*
 *@author: YangJie
 *@date: 2021-04-07 16:48:13
 *@version:
 *@description:维修保养=>故障报修
 */
 import React, { Component } from 'react';
 import { Table, Button, Form, Tabs ,Input , TreeSelect ,DatePicker,Select,Switch,Row,Col, Modal , InputNumber,Spin } from 'antd';
 import '@/assets/css/settings';
 import * as Utils from '../../utils_yyr/action';
 import { withRouter } from 'react-router-dom';
import Paging from '../../components_yyr/commponent/Paging';
import { euqApplicationName, lotAuth, lotAuth2 } from '../../config';
 import moment from 'moment';
 import 'moment/locale/zh-cn';
 moment.locale('zh-cn')
 
 const nowDate = Utils.getNowDate()
 const { TabPane } = Tabs;
 const {TreeNode} = TreeSelect
 const {Option} = Select
 const { TextArea } = Input
 const FormItem = Form.Item;
 
 class App extends Component {
	 state = {
		 loading: false, //加载中...
		 dataSource: [], //数据源
		 dataSource1: [],
		 drawerVisible: false, //新增修改抽屉的显示与隐藏
		 chooseData: {},
		 drawerTitle: '',
		 total: 0,
		 formValues: {},
		 cityData: [],
		 mainFactoryList: [],
		 selectedData: [],
		 selectedKeys: [],
		 handleType:0,
		 EquTypePageList:[],
		 gzdj:[],//故障等级列表,
		 gzlb:[],//故障类型列表,
		 DepartmentList:[],//部门列表
		 UserList:[],//用户查询
		 jjcd:[],//紧急程度列表
		 wxz:[],
		 visibleEqu :false,
		 loadingTable: false,
		 tableData: [],
		 totalTable:0,
		 formValuesTable:{},
		 selectedDataTable: [],
		 status:0,
		 selectedKeysTable: [],
		 value:1,
		 wxlb:[],
		 wxjb:[],
		 wxzt:[],
		 gzyy:[],
		 zydw:[],
		 wldw:[],
		 visiblePeo:false,
		 equipmentRepairWorkAddDTOList:[],
		 switchChecked:false,
		 selectedDataTable: [],
		 selectedKeysTable:[],
		 totalTablePeo:0,
		 formValuesTablePeo:{},
		 peopleData:[],
		 dateStartTime:'',
		 dateEndTime:'',
		 dateEndDisabeld:true,datePickerLoading:false,sbbw:[],Spining:false
	 };
	 componentDidMount() {
		 this.setState({Spining:true})
		 this.gzdj();
		 this.gzlb();
		 this.EquTypePageList()
		 this.queryTreeDepartment()
		 this.queryPageUser()
		 this.jjcd()
		 this.wxz()
		 this.wxjb()
		 this.wxlb()
		 this.wxzt()
		 this.gzyy()
		 this.zydw()
		 this.wldw()
		 setTimeout(() => {
			 this.fetch();
		 }, 30);
	 }
	 //初始化加载数据
	 fetch = () => {
		let loc = window.location.href.split('/');
		let id = loc[loc.length-1]
		this.get(euqApplicationName + '/equipmentMaintenanceRecord/findEquipmentMaintenanceRecordList?id='+id).then(res => {
			console.log(res)
			let data = res.data.data && res.data.data.length === 1 ? res.data.data[0] : []
			if(data.equipmentType){
				this.sbbw(data.equipmentType)
			}
			if(data.maintenanceStartTime){
				this.setState({
					dateStartTime:data.maintenanceStartTime
				})
			}
			if(data.maintenanceEndTime){
				this.setState({
					dateEndTime:data.maintenanceEndTime
				})
			}
			const arr = [ 'repairOrderNum','equipmentNum','specificationAndModule', 'equipmentName','equipmentTypeName','dept','positionId','occurrenceTime','operator','equipmentLocation','maintenanceCategory','faultLevel','faultDescription','repairCause','maintenanceTeam','repairStatus','maintenanceLevel','maintenanceCategory','urgency','isStop', 'downtime','dateSec_maintenanceStartTime','dateSec_maintenanceEndTime','hours','miuntes','maintenanceCosts','outsourcingUnit','workDescription','faultCategory','repairOrderNum','repairMan','repairTime']
			let obj = {}
			for(var item of arr){
				if (item.indexOf('dateSec_') === 0) {
					let arrs = item.split('_');
					if(data[arrs[1]]){
						obj[`${item}`] = moment(data[arrs[1]])
					}
					// data[arrs[1]] = moment(data[arrs[1]],"YYYY-MM-DD");
					// obj[`${item}`] = data[`${arrs[1]}`]
				}
				else if(item==='isStop'){
					obj[`isStop`] = data[`isStop`] ? true : false	
				}else if(item==='hours'){
					obj[`hours`] = data[`maintenanceTime`] ? data[`maintenanceTime`].split('小时')[0] : 0	
				}else if(item==='miuntes'){
					obj[`miuntes`] = data[`maintenanceTime`] ? data[`maintenanceTime`].split('小时')[1].split('分')[0] : 0	
				}else {
					if(data[`${item}`]){
						obj[`${item}`] = data[`${item}`]
					}
				}
			}
			console.log(Object.keys(data))
			setTimeout(() => {
				this.props.form.setFieldsValue(obj)
				this.setState({Spining:false})
			}, 30);
			this.setState({
				drawerTitle: data.status === 1 || data.status === 2 ? '修改' : '详情',
				drawerVisible: true,
				chooseData: data,
				status:data.status,
				equipmentRepairWorkAddDTOList : Object.keys(data).length>0 && data.equipmentRepairWorkAddDTOList ? data.equipmentRepairWorkAddDTOList : []
			});
		})
		
		 
	 };
	 sbbw = (datqa) => {
		this.get(euqApplicationName + '/parameter_setting_equipmentType/findEquTypeRegionPageList/'+datqa).then(res=>{
			this.setState({sbbw:res.data})
		 })
	 }
	 zydw = () => {//租用单位列表
		this.get(euqApplicationName + '/parameter_setting_public/queryRentDepartmentList?type=2').then(res => {
			this.setState({
				zydw: res.data,
			});
		})
	   }
	
	   wldw = () => {//往来单位列表
		this.get(euqApplicationName + '/parameter_setting_public/queryRentDepartmentList?type=1').then(res => {
			this.setState({
				wldw: res.data,
			});
		})
	   }	
	 //   用户查询
	 queryPageUser = () => {
		 this.get(lotAuth2 + '/user/queryPageUser').then(res => {
			 this.setState({
				 UserList : res.data.data
			 });
		 })
	 }
	 // 部门查询
	 
	 queryTreeDepartment = () => {
		//  this.get(lotAuth + '/department/queryTreeDepartment').then(res => {
			 this.get(lotAuth2 + '/department/queryTreeDepartment').then(res => {
			 this.setState({
				 DepartmentList : res.data
			 });
		 })
	 }
 
	 EquTypePageList = () => {
		 this.get(euqApplicationName + '/parameter_setting_equipmentType/findEquTypePageList').then(res1 => {
			 this.setState({
				 EquTypePageList : res1.data
			 });
		 })
	 }
	 wxz = () => {//维修组
		this.get(euqApplicationName + '/parameter_setting_public/queryTeamPageList?type=维修').then(res => {
		this.setState({
			 wxz: res.data,
		 });
		 })
	}; 
	 gzdj = () => {//故障等级列表
		this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=3').then(res => {
		this.setState({
			 gzdj: res.data,
		 });
		 })
	}; 
	jjcd = () => {//紧急程度列表
	   this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=8').then(res => {
	   this.setState({
		 jjcd: res.data,
		});
		})
   }; 
   gzyy = () => {//故障原因列表
	this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=4').then(res => {
	this.setState({
		gzyy: res.data,
	 });
	 })
}; 
   wxjb = () => {//维修级别列表
	  this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=5').then(res => {
	  this.setState({
		wxjb: res.data,
	   });
	   })
  }; 
  wxlb = () => {//维修类别列表
	 this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=7').then(res => {
	 this.setState({
		wxlb: res.data,
	  });
	  })
 }; 
 wxzt = () => {//维修状态列表
	this.get(euqApplicationName + '/api/findEquipmentNextParameterPageList?typeId=11').then(res => {
	this.setState({
		wxzt: [{configValue:'已完成',id:158}],
	 });
	 })
}; 
	gzlb = () => {//故障类型列表
	   this.get(euqApplicationName + '/api/findEquFaultTypePageList').then(res => {
	   this.setState({
		 gzlb: res.data,
		});
		})
   }; 
	 getInfo = () => {
		 this.post('/carrierPrice/mainFactoryList').then(res => this.setState({ mainFactoryList: res.data })); //主机厂
	 };
 
	 //表单查询
	 filterSubmit = values => {
		 console.log("表单查询=====", values)
 
		 values.pageNum = this.state.formValues.pageNum;
		 values.pageSize = this.state.formValues.pageSize;
		 this.fetch(values);
	 };
 
	 // 表格删除
	 handleConfirm = (value, api, chooseData) => {
		 console.log(this.state.selectedData)
		 let str = ''
		 for(var item of this.state.selectedData){
			 str += item.informationId + ','
		 }
		 this.get(`${euqApplicationName}/equipmentRepairFault/deleteEquipmentRepairFaultList?ids=${str.slice(0, str.length - 1)}`).then(res => {
			 this.success();
			 this.fetch({ ...this.state.formValues });
			 this.setState({selectedKeys:[],selectedData:[]})
		 });
	 };
 
	 // 表格打印
	 handlePrinting = (type, data) => {
		 console.log("打印=====")
	 }
 
	 formList = () => {
		 const formList = [
			 {
				 type: 'SELECT', label: '处理状态', field: 'status', name: 'value',
				 // 处理状态1.待审核 2.审核中 3.待维修 4.维修中 5.待验证 6.已完成
				 list: [{ id: 1, value: '待审核' }, { id: 2, value: '审核中' }, { id: 3, value: '待维修' }, { id: 4, value: '维修中' }, { id: 5, value: '待验证' }, { id:6, value: '已完成' }],
				 valueField: 'id'
			 },
			 {
				 type: 'SELECT', label: '报修人', field: 'operator', name: 'value', name: 'userName', valueField: 'userId', list: this.state.UserList ,
			 },
			 // {
			 // 	type: 'SELECT', label: '相关性', field: 'route', name: 'value',
			 // 	list: [{ id: 1, value: '我报修' }, { id: 2, value: '待我审核' }],
			 // 	valueField: 'value'
			 // }
		 ];
		 return formList;
	 };
	 
	 formListModal = () => {
		 const {  EquTypePageList, DepartmentList } = this.state;
		 const formList = [
			 { type: 'TREESELECT', label: '设备类别', field: 'equipmentTypeName',  name: 'name', valueField: 'id', list:EquTypePageList,allowClear:true},
			 { type: "TREESELECT", label: "所在部门", field: "deptId", name: 'name', valueField: 'id', list: DepartmentList},
		 ];
		 return formList;
	 };
 
	 //表单查询
	 filterSubmitModal = values => {
		 console.log("表单查询=====", values)
 
		 values.pageNum = this.state.formValues.pageNum;
		 values.pageSize = this.state.formValues.pageSize;
		 this.fetch(values);
	 };
	 drawerFormList = data => {
		 const { mainFactoryList , EquTypePageList ,gzdj ,gzlb , DepartmentList ,UserList, jjcd} = this.state;
		 const drawerFormList = [
			 { type: 'TITLE', label: '设备信息' },
			 { type: "INPUT", label: "设备编号", field: "equipmentNum", initialValue: data.equipmentNum},
			 { type: "INPUT", label: "设备名称", field: "equipmentName", initialValue: data.equipmentName, required: true },
			 { type: 'TREESELECT', label: '设备类别', field: 'equipmentTypeName', initialValue: data.equipmentTypeName, name: 'name', valueField: 'id', list:EquTypePageList,allowClear:true},
			 { type: "INPUT", label: "规格型号", field: "specificationAndModule", initialValue: data.specificationAndModule },
			 { type: "TREESELECT", label: "所在部门", field: "deptId", initialValue: data.deptId, name: 'name', valueField: 'id', list: DepartmentList},
			 { type: "INPUT", label: "设备位置", field: "positionId", initialValue: data.positionId },
			 { type: "BUTTON", label: "选择设备", modalType:'TABLE',ModalProps:{
				 
			 }},
 
			 { type: 'TITLE', label: '处理情况' },
			 { type: "DATE", label: "发生时间", field: "dateSec_occurrenceTime", initialValue: data.occurrenceTime ? data.occurrenceTime : nowDate, required: true ,showTime:true },
			 { type: "INPUT", label: "操作人", field: "operator", initialValue: data.operator },
			 { type: "INPUT", label: "操作者电话", field: "operatorTel", initialValue: data.operatorTel },
			 { type: "SELECT", label: "故障等级", field: "faultLevel", initialValue: data.faultLevel, name: 'configValue', valueField: 'id', list: gzdj },
			 { type: "TREESELECT", label: "故障类别", field: "faultTypeId", initialValue: data.faultTypeId, name: 'name', valueField: 'id', list: gzlb ,allowClear:true },
			 { type: "SELECT", label: "维修组", field: "maintainTeamId", initialValue: data.maintainTeamId, name: 'value', valueField: 'id', list: mainFactoryList.wxGroup },
			 { type: "SELECT", label: "紧急程度", field: "urgency", initialValue: data.urgency, name: 'configValue', valueField: 'id', list: jjcd},
			 { type: "RADIO", label: "是否停机", field: "isStop", initialValue: data.isStop ,
			 list: [{ id: 1, name: '停机' },{ id: 0, name: '不停机' , checked : true }],name: 'name', valueField: 'id',},
			 // { type: "INPUT", label: "经验代码", field: "uniqueAddress", initialValue: data.uniqueAddress, list: mainFactoryList },
			 { type: "SELECT", label: "下一审核人", field: "lastOperate", initialValue: data.lastOperate, name: 'userName', valueField: 'userId', list: UserList ,required:true },
			 { type: "TEXTAREA", label: "故障描述", field: "faultDescription", initialValue: data.faultDescription, required: true },
			 // { type: "BOTTOM", label: "经验库", field: "harborMinimumPrice", initialValue: data.harborMinimumPrice },
 
		 ];
		 let obj = { type: "FILEUPLOAD", label: "图片上传", field: "upload_pictureId" ,apiPath:'/lot-file/file/uploadFile' ,buttonName:'上传图片' , fileId :true}
		 if(this.state.handleType === 0){
			 drawerFormList.push(obj)
		 }
		 return drawerFormList;
	 };
 
	 lastOperateIsChoose = () => {
		 console.log(this.state.equipmentRepairWorkAddDTOList)
		 const p = this
		 this.handleSubmit()
	 }
 
	 // 提交modal
	 handleSubmitApply = () => {
		 const { dataSource, chooseData , selectedDataTable} = this.state;
		 const p = this;
		 const { form } = this.props;
		 const apply = ['operateId','maintainTeamId','checkReview','repairWorker','planExeTime','dealReview','lastOperate']
		 form.validateFieldsAndScroll(apply,(err, fieldsValue) => {
			 if (err) {
				 return;
			 }
			 console.log(fieldsValue)
			 for (var key in fieldsValue) {
				 //单个时间选择器--需要时分秒
				 if (key === 'planExeTime') {
					 if (fieldsValue[key]) {
						 fieldsValue[key] = Utils.getDateHHMMYY_HHMMSS(fieldsValue[key]);
					 }
				 }
			 }
			 const id = this.state.chooseData && this.state.chooseData.id;
			 fieldsValue.repairInfoId = id;
			 fieldsValue.userId = localStorage.getItem('userId');
			 fieldsValue.operateId = localStorage.getItem('userId');
			 fieldsValue.informationId = chooseData.informationId
			 console.log(fieldsValue)
			 this.post(euqApplicationName + '/equipmentRepairFault/failureReportAudit', { data : fieldsValue }).then(res => {
				 this.success();
				 this.fetch({ ...this.state.formValues });
				 this.onClose();
			 });
			 });
		 
	 };
	 // 提交modal
	 handleSubmit = () => {
		const { dataSource, chooseData , selectedDataTable,equipmentRepairWorkAddDTOList} = this.state;
		const p = this;
		const { form } = this.props;
		form.validateFieldsAndScroll([ 'repairOrderNum','equipmentNum', 'equipmentName','equipmentTypeName','deptId','positionId','occurrenceTime','operator','equipmentLocation','maintenanceCategory','faultLevel','faultDescription','repairCause','maintenanceTeam','repairStatus','maintenanceLevel','maintenanceCategory','urgency','isStop', 'downtime','dateSec_maintenanceStartTime','dateSec_maintenanceEndTime','hours','miuntes','maintenanceCosts','outsourcingUnit','workDescription','faultCategory','repairOrderNum','repairMan','repairTime'],(err, fieldsValue) => {
			if (err) {
				return;
			}
			for (var key in fieldsValue) {
				//单个时间选择器--需要时分秒
				if (key.indexOf('dateSec_') === 0) {
					if (fieldsValue[key]) {
						let arr = key.split('_');
						fieldsValue[arr[1]] = Utils.getDateHHMMYY_HHMMSS(fieldsValue[key]);
					}
					delete fieldsValue[key];
				}
			}
			if(fieldsValue.maintenanceStartTime && chooseData.occurrenceTime){
				let diffTime = this.diffTime(chooseData.occurrenceTime,fieldsValue.maintenanceStartTime)
				console.log(this.diffTime(chooseData.occurrenceTime,fieldsValue.maintenanceStartTime))
				if(!diffTime){
					Utils.openNotification('warning','开始时间需大于报修时间！')
					return
				}
			}
			if(fieldsValue.maintenanceStartTime && fieldsValue.maintenanceEndTime){
				let diffTime = this.diffTime(fieldsValue.maintenanceStartTime,fieldsValue.maintenanceEndTime)
				if(!diffTime){
					Utils.openNotification('warning','开始时间不能大于结束时间！')
					return
				}
			}
			console.log(fieldsValue.repairStatus,'11')
			if(fieldsValue.repairStatus==158){
				if(!fieldsValue.maintenanceEndTime){
					Utils.openNotification('warning','状态已完成,请选择维修结束时间！')
					return
				}
				if(equipmentRepairWorkAddDTOList.length==0){
					Utils.openNotification('warning','状态已完成,请添加维修人员！')
					return
				}
				for(var lists of equipmentRepairWorkAddDTOList){
					if(!lists.repairStartTime || !lists.repairEndTime){
						Utils.openNotification('warning','部分人员未填写维修工作时间！')
						return
					}
				}
				for(var iiiii of equipmentRepairWorkAddDTOList){
					console.log(iiiii)
					if(iiiii.repairStartTime){
						let str = this.diffTime(fieldsValue.maintenanceStartTime,iiiii.repairStartTime)
						console.log(str)
						if(str[2]!=0 && str[2]<0){
							Utils.openNotification('warning','个人维修时间不在总维修时间范围内！')
							return
						}
					}
					if(iiiii.repairEndTime){
						let str = this.diffTime(iiiii.maintenanceEndTime,fieldsValue.repairEndTime)
						console.log(str)
						if(str[2]!=0 && str[2]<0){
							Utils.openNotification('warning','个人维修时间不在总维修时间范围内！')
							return
						}
					}
				}
			}
			fieldsValue.isStop = fieldsValue.isStop ? 1 : 0
			fieldsValue.equId = selectedDataTable.length===1 ? selectedDataTable[0].id : chooseData.equId
			const id = this.state.chooseData && this.state.chooseData.id;
			fieldsValue.id = id;
			fieldsValue.faultInformationId = this.state.chooseData.faultInformationId
			fieldsValue.repairTreatmentId = this.state.chooseData.repairTreatmentId
			fieldsValue.userId = localStorage.getItem('userId');
			fieldsValue.equipmentRepairWorkAddDTOList = equipmentRepairWorkAddDTOList
			fieldsValue.maintenanceTime = `${fieldsValue.hours ? fieldsValue.hours : 0}小时${fieldsValue.miuntes ? fieldsValue.miuntes : 0}分`
			fieldsValue.outsource = fieldsValue.outsourcingUnit
			fieldsValue.bShi = 1
			console.log(fieldsValue)
			this.post(euqApplicationName + '/equipmentMaintenanceRecord/saveEquipmentMaintenanceRecord', { data : fieldsValue }).then(res => {
				this.success();
				this.props.history.push('/MaintenanceRecords')
			});
		});
		 
	 };
 
	 // 打开modal，判断是修改还是新增 0新增 1修改
	 handleModal = (type, data) => {
		 if (type===1) {
			 const arr = [ 'faultDescription','isStop','urgency','maintainTeamId','faultTypeId','faultLevel','operatorTel','operator','dateSec_occurrenceTime','equipmentNum', 'equipmentName','equipmentTypeName','specificationAndModule','dept','positionId','lastOperate']
			 let obj = {}
			 for(var item of arr){
				 if(item==='dateSec_occurrenceTime'){
					 obj['dateSec_occurrenceTime'] = moment(data['occurrenceTime']) 
				 }else if(item==='isStop'){
					 obj[`isStop`] = data[`isStop`] ? true : false	
				 }else {
					 obj[`${item}`] = data[`${item}`]
				 }
			 }
			 setTimeout(() => {
				 this.props.form.setFieldsValue(obj)
			 }, 50);
			 this.setState({
				 drawerTitle: data.status === 1 || data.status === 2 ? '修改' : '详情',
				 drawerVisible: true,
				 chooseData: data,
				 handleType:type,
				 status:data.status
			 });
		 } else if(type===0){
			 this.setState({
				 drawerTitle: '新增',
				 drawerVisible: true,
				 chooseData: data,
				 handleType:type,
				 status:data.status
			 });
		 } else if (type===2) {
			 // 'operateId''maintainTeamId''checkReview','repairWorker','planExeTime','dealReview' -----审核
			 const arr = [ 'faultDescription','isStop','urgency','maintainTeamId','faultTypeId','faultLevel','operatorTel','operator','dateSec_occurrenceTime','equipmentNum', 'equipmentName','equipmentTypeName','specificationAndModule','dept','positionId','lastOperate',]
			 let obj = {
				 'operateId' : data['lastOperate'],
				 'maintainTeamId' : data['maintainTeamId'],
			 }
			 for(var item of arr){
				 if(item==='dateSec_occurrenceTime'){
					 obj['dateSec_occurrenceTime'] = moment(data['occurrenceTime']) 
				 }else if(item==='isStop'){
					 obj[`isStop`] = data[`isStop`] ? true : false	
				 }else {
					 obj[`${item}`] = data[`${item}`]
				 }
			 }
			 setTimeout(() => {
				 this.props.form.setFieldsValue(obj)
			 }, 50);
			 this.setState({
				 drawerTitle: '审核',
				 drawerVisible: true,
				 chooseData: data,
				 handleType:type,
				 status:data.status
			 });
		 } 
	 };
 
	 onClose = () => {
		 this.setState({
			 drawerVisible: false,
			 chooseData: {},
			 status:0
		 });
		 this.props.form.resetFields();
	 };
	 onTreeChange = () => { };
 
	 renderTreeNodes = (data, name, valueField) =>
	 // console.log(data, name, valueField)
		 data && data.map(item => {
			 if (item.children) {
				 return (
					 <TreeNode title={item[name]} key={item[valueField]} value={item[valueField]} dataRef={item}>
						 {this.renderTreeNodes(item.children, name, valueField)}
					 </TreeNode>
				 );
			 }
			 return <TreeNode key={item[valueField]} value={item[valueField]} title={item[name]} {...item} />;
		 });
 
	 chooseEqu = () => {
		 this.fetchTable({
			 pageNum: 1,
			 pageSize: 10
		 })
		 this.setState({visibleEqu : true})
	 }
	 choosePeo = () => {
		this.fetchTablePeo({
			pageNum: 1,
			pageSize: 10
		})
		this.setState({visiblePeo : true})
	}
 
	 fetchTable = (data) => {
		 let str = ''
		 for(var key in data){
			 if(data[key]){
				 str += `&${key}=${data[key]}`
			 }
		 }
		 this.setState({ loadingTable: true })
		 this.get(euqApplicationName + '/equipmentInfo/findEquInfoList?'+str).then(res => {
			 this.setState({
				 loadingTable: false,
				 tableData: res.data.data,
				 totalTable:res.data.total,
				 formValuesTable:data,
				 selectedKeysTable:[],
				 selectedDataTable:[],
			 });
		 })
	 }
	 fetchTablePeo = (data) => {
		let str = ''
		for(var key in data){
			if(data[key]){
				str += `&${key}=${data[key]}`
			}
		}
		this.setState({loadingTable:true})
		this.get(euqApplicationName + '/equipmentMaintain/findUserOfMaintain?'+str).then(res => {
			this.setState({
				loadingTable:false,
				peopleData: res.data,
				totalTablePeo:res.total,
				formValuesTablePeo:data,
				selectedKeysTablePeo:[],
				selectedDataTablePeo:[],
			});
		})
	}
 
	 closeModal = () => {
		 this.setState({visibleEqu:false,visiblePeo:false})
	 }
 
	 modalSubmit = () => {
		 if(this.state.selectedKeysTable.length!==1){
			 Utils.openNotification('warning','请（仅）选择一条数据！')
			 return;
		 }
		 let data = this.state.selectedDataTable[0]
		 // 'equipmentNum', 'equipmentName','equipmentTypeName','specificationAndModule','deptId','positionId'
		 this.props.form.setFieldsValue({
			 equipmentNum : data.equipmentNum,
			 equipmentName : data.equipmentName,
			 equipmentTypeName : data.equipmentTypeNameId,
			 specificationAndModule : data.specificationAndModule,
			 deptId : data.depId,
			 positionId : data.equipmentLocation,
		 })
		 this.closeModal()
	 }
	  
	 modalSubmitPeo = () => {
		if(this.state.selectedKeysTablePeo.length===0){
			Utils.openNotification('warning','请选择数据！')
			return;
		}
		let {equipmentRepairWorkAddDTOList} = this.state
		let data = this.state.selectedDataTablePeo
		for(var item of data){
			item.personId = item.id
			item.personName = item.userName
		}
		// 'repairStartTime' ,'repairEndTime' ,'wastedTime' ,'contentOrSteps',
		let newData = [...equipmentRepairWorkAddDTOList];
		console.log(newData)
		const ids = newData.map(item => item.id);
		data.forEach(item => {
			ids.indexOf(item.id) === -1 && newData.push({
				id: null,
				personId: item.id,
				personName: item.userName,
				// repairStartTime: nowDate,
				// repairEndTime: nowDate,
				wastedTime: '',
				contentOrSteps: '',
			});
		});
		console.log(newData)
		this.setState({
			equipmentRepairWorkAddDTOList:newData
		})
		this.closeModal()
	}
	 TableSearch = () => {
		 this.props.form.validateFields(['depId','equipmentTypeNameId'],(err,values)=>{
			 if(!err){
				 console.log(values)
				 values.pageNum = this.state.formValuesTable.pageNum;
				 values.pageSize = this.state.formValuesTable.pageSize;
				 this.fetchTable(values);
			 }
		 })
	 }
	 TableSearchPeo = () => {
		this.props.form.validateFields(['userName'],(err,values)=>{
			if(!err){
				console.log(values)
				values.pageNum = this.state.formValuesTable.pageNum;
				values.pageSize = this.state.formValuesTable.pageSize;
				this.fetchTablePeo(values);
			}
		})
	}
 
	 onChangeRadio = e => {
		 // console.log('radio checked', e.target.value);
		 let value = e.target.value
		 this.setState({
		   value,
		 });
	   };
		inputNumber = (e,record,index) => {
		   let {equipmentRepairWorkAddDTOList} = this.state
		   record.wastedTime = e.target.value
		   console.log(e.target.value,record,index)
		}
		input1 = (e,record,index) => {
		   let {equipmentRepairWorkAddDTOList} = this.state
		   record.contentOrSteps = e.target.value
		   console.log(e.target.value,record,index)
		}
		handleDelete = key => {
			const equipmentRepairWorkAddDTOList = [...this.state.equipmentRepairWorkAddDTOList];
			this.setState({ equipmentRepairWorkAddDTOList: equipmentRepairWorkAddDTOList.filter(item => item.personId !== key) });
		};
		SwitchOnChange = (checked) => {
			this.setState({switchChecked:checked})
		}
		datePickerStart = (date,dateString,record,index) => {
			let {equipmentRepairWorkAddDTOList} = this.state
			console.log(date,dateString,record,index)
			record.repairStartTime =  Utils.getDateHHMMYY_HHMMSS(date)
			if(record.repairEndTime){
				this.setState({datePickerLoading:true})
				let str = this.diffTime(Utils.getDateHHMMYY_HHMMSS(date),record.repairEndTime)
				console.log(str)
				if(str[2]!=0 && str[2]<0){
					Utils.openNotification('warning','开始时间不能大于结束时间！')
					record.wastedTime = 0
					this.setState({datePickerLoading:false})
				}else{
					this.setState({datePickerLoading:false})
					record.wastedTime = (str[0]*24+str[1])*60 + str[2] 
				}
			}
	   }
		datePickerEnd = (date,dateString,record,index) => {
			let {equipmentRepairWorkAddDTOList} = this.state
			console.log(date,dateString,record,index)
			record.repairEndTime = Utils.getDateHHMMYY_HHMMSS(date)
			if(record.repairStartTime){
				this.setState({datePickerLoading:true})
				let str = this.diffTime(record.repairStartTime,Utils.getDateHHMMYY_HHMMSS(date))
				console.log(str)
				if(str[2]!=0 && str[2]<0){
					Utils.openNotification('warning','开始时间不能大于结束时间！')
					this.setState({datePickerLoading:false})
					record.wastedTime = 0
				}else{
					record.wastedTime = (str[0]*24+str[1])*60 + str[2] 
					this.setState({datePickerLoading:false})
				}
			}
		}
		dateonChangeStart = (date,dateString) => {
			const { chooseData } = this.state;
			console.log(dateString)
			this.setState({dateStartTime:Utils.getDateHHMMYY_HHMMSS(date),dateEndDisabeld:false})
			if(chooseData.repairTime){
				let str = this.diffTime(chooseData.repairTime,Utils.getDateHHMMYY_HHMMSS(date))
				if(str[2]!=0 && str[2]<0){
					Utils.openNotification('warning','开始时间需大于报修时间！')
					return
				}
			}else if(chooseData.occurrenceTime){
				let str = this.diffTime(chooseData.occurrenceTime,Utils.getDateHHMMYY_HHMMSS(date))
				if(str[2]!=0 && str[2]<0){
					Utils.openNotification('warning','开始时间需大于发生时间！')
					return
				}
			}
			if(this.state.dateEndTime){
				let str = this.diffTime(Utils.getDateHHMMYY_HHMMSS(date),this.state.dateEndTime)
				console.log(str)
				if(str[2]!=0 && str[2]<0){
					Utils.openNotification('warning','开始时间不能大于结束时间！')
					this.props.form.setFieldsValue({'hours':0,'dateSec_maintenanceStartTime':''})
				}else{
					this.props.form.setFieldsValue({'hours':str[0]*24+str[1],'miuntes':str[2]})
				}
				// if(str>0){
				// 	this.props.form.setFieldsValue({'hours':str*24})
				// }else{
				// 	Utils.openNotification('warning','开始时间不能大于结束时间！')
				// 	this.props.form.setFieldsValue({'hours':0,'dateSec_maintenanceStartTime':moment('')})
				// }
			}
		}
		dateonChangeEnd = (date,dateString) => {
			console.log(dateString)
			this.setState({dateEndTime:Utils.getDateHHMMYY_HHMMSS(date)})
			if(this.state.dateStartTime){
				let str = this.diffTime(this.state.dateStartTime,Utils.getDateHHMMYY_HHMMSS(date))
				console.log(str)
				if(str[2]!=0 && str[2]<0){
					Utils.openNotification('warning','开始时间不能大于结束时间！')
					this.props.form.setFieldsValue({'hours':0,'dateSec_maintenanceStartTime':''})
				}else{
					this.props.form.setFieldsValue({'hours':str[0]*24+str[1],'miuntes':str[2]})
				}
				// if(str>0){
				// 	this.props.form.setFieldsValue({'hours':str*24})
				// }else{
				// 	Utils.openNotification('warning','开始时间不能大于结束时间！')
				// 	this.props.form.setFieldsValue({'hours':0,'dateSec_repairEndTime':moment('')})
				// }
			}
		}
		disabledDate = (current) => {
			const { dateStartTime,chooseData } = this.state;
			if(chooseData.repairTime){
				// 核心逻辑: 结束日期不能多余开始日期后60天，且不能早于开始日期
				return current < moment(chooseData.repairTime) || current > moment().endOf('time');
			} else if(chooseData.occurrenceTime){
				// 核心逻辑: 结束日期不能多余开始日期后60天，且不能早于开始日期
				return current < moment(chooseData.occurrenceTime) || current > moment().endOf('time');
			} 
			 else {
				return null;
			}
		 }
		 
		 handleEndDisabledDate = (current) => {
		   const { dateStartTime,chooseData } = this.state;
		   if (dateStartTime) {
				   // 核心逻辑: 结束日期不能多余开始日期后60天，且不能早于开始日期
				return current < moment(dateStartTime) || current > moment().endOf('time');
			} else {
				return null;
			}
		   
		 }
		diffTime = (startDate,endDate) => { 
			startDate= new Date(startDate);
			endDate = new Date(endDate);
			console.log(startDate.getTime())
			var diff=endDate.getTime() - startDate.getTime();//时间差的毫秒数 
		   
			//计算出相差天数 
			var days=Math.floor(diff/(24*3600*1000)); 
				
			//计算出小时数 
			var leave1=diff%(24*3600*1000);    //计算天数后剩余的毫秒数 
			var hours=Math.floor(leave1/(3600*1000)); 
			//计算相差分钟数 
			var leave2=leave1%(3600*1000);        //计算小时数后剩余的毫秒数 
			var minutes=Math.floor(leave2/(60*1000)); 
				
			//计算相差秒数 
			var leave3=leave2%(60*1000);      //计算分钟数后剩余的毫秒数 
			var seconds=Math.round(leave3/1000); 
			   
			return [days,hours,minutes]; 
		}     
	 render() {
		 const columns = [
			//  {
			// 	 title: '删除', width: 80, 
			// 	 render: (text, record) => {
			// 		 return <span><a href onClick={() => this.handleDelete(record.personId)}>删除</a></span>
			// 	 }
			//  },
			 { title: '姓名', width: 150, dataIndex: 'personName' },
			 { title: '维修开始时间', width: 150, dataIndex: 'repairStartTime' ,render:(text,record,index)=>{
				return <DatePicker onChange={(date,dateString)=>this.datePickerStart(date,dateString,record,index)} defaultValue={text ? moment(text) : ''} format="YYYY-MM-DD HH:mm"/>
			}
		   },
			 { title: '维修完成时间', width: 150, dataIndex: 'repairEndTime' ,render:(text,record,index)=>{
				return <span>
				<DatePicker onChange={(date,dateString)=>this.datePickerEnd(date,dateString,record,index)} defaultValue={text ? moment(text) : ''}format="YYYY-MM-DD HH:mm" />
				</span>
			// return <span></span> 
			// <DatePicker onChange={(date,dateString,record,index)=>this.datePickerEnd(date,dateString,record,index)}/>
			}},
			{ title: '维修用时（分钟）', width: 150, dataIndex: 'wastedTime' ,
				//  render:(text,record,index)=>{
				// 	return <InputNumber defaultValue={text ? text : ''} onBlur={(e)=>this.inputNumber(e,record,index)} onPressEnter={(e)=>this.inputNumber(e,record,index)}/>
				// }
			},
			//  { title: '实际维修工时', width: 200, dataIndex: 'wastedTime' },
			 { title: '内容或步骤', width: 150, dataIndex: 'contentOrSteps',render:(text,record,index)=>{
				return <Input defaultValue={text ? text : ''} onBlur={(e)=>this.input1(e,record,index)} onPressEnter={(e)=>this.input1(e,record,index)}/>
			} },
		 ];
 
		 const column = [
			 { title: '设备编码', width: 150, dataIndex: 'equipmentNum' },
			 { title: '设备名称', width: 150, dataIndex: 'equipmentName' },
			 { title: '规格型号', width: 150, dataIndex: 'specificationAndModule' },
			 { title: '使用部门', width: 150, dataIndex: 'userDepartment' },
			 { title: '设备类别', width: 150, dataIndex: 'equipmentTypeNameName' },
			 { title: '设备位置', width: 150, dataIndex: 'equipmentLocation' },
		 ]
		 const columnPeo = [
			{ title: '名称', width: 150, dataIndex: 'userName' },
			{ title: '职务', width: 150, dataIndex: 'roleName' },
			{ title: '使用部门', width: 150, dataIndex: 'department' },
			{ title: '执行班组', width: 150, dataIndex: 'teamName' },
		 ]
		 const { chooseData, drawerVisible, drawerTitle, dataSource, dataSource1, loading, total, formValues, selectedData, selectedKeys ,visibleEqu ,totalTable ,formValuesTable ,loadingTable ,selectedKeysTable ,visiblePeo ,equipmentRepairWorkAddDTOList,selectedKeysTablePeo,selectedDataTablePeo,formValuesTablePeo,totalTablePeo,peopleData} = this.state;
		 const { mainFactoryList , EquTypePageList ,gzdj ,gzlb , DepartmentList ,UserList, jjcd ,wxz ,wxjb ,wxlb,wxzt,gzyy , zydw , wldw,sbbw} = this.state;
 
		 const drawerProps = {
			 // onRef: ref => (this.modalRef = ref),
			 visible: drawerVisible,
			 width: 1000,
			 // drawerFormList: this.drawerFormList(chooseData),
			 submit: this.lastOperateIsChoose,
			 onClose: this.onClose,
			 title: drawerTitle,
		 };
 
		 //选择框
		 const rowSelectionTablePeo = {
			 selectedRowKeys: selectedKeysTablePeo,
			 onChange: (selectedRowKeys, selectedRows) => {
				 this.setState({
					 selectedDataTablePeo: selectedRows,
					 selectedKeysTablePeo: selectedRowKeys
				 })
			 },
		 };
 
		 const rowSelectionTable = {
			 selectedRowKeys: selectedKeysTable,
			 onChange: (selectedRowKeys, selectedRows) => {
				 this.setState({
					 selectedDataTable: selectedRows,
					 selectedKeysTable: selectedRowKeys
				 })
			 },
		 }
		 const { getFieldDecorator}=this.props.form
		 const p = this
		 const modalProps = {
			 title:"选择设备",
			 visible:visibleEqu,
			 width : '780px',
			 onCancel() {
			   p.closeModal();
			 },
			 okText:'保存',
			 cancelText:'取消',
			 onOk(){
			   p.modalSubmit();
			 }
		   };
		   
		 const modalPropsPeople = {
			title:"选择人员",
			visible:visiblePeo,
			width : '780px',
			onCancel() {
			  p.closeModal();
			},
			okText:'保存',
			cancelText:'取消',
			onOk(){
			  p.modalSubmitPeo();
			}
		  };
		const wwdw = zydw.concat(wldw)
		 return (
			<div className="shadow-radius">
				<Spin spinning={this.state.Spining}>
				<Modal {...modalPropsPeople}>
					<Form  {... {labelCol: {xs: { span: 30 },sm: { span:6 },},wrapperCol: {xs: {span: 24},sm: {span: 14}}}}>
					<Row gutter={24}>
						<Col span={10}>
								<Form.Item label="姓名">
									{getFieldDecorator('userName')(
										<Input placeholder='请输入姓名' allowClear/>)}
								</Form.Item>
						</Col>
						{/* <Col span={10}>
								<Form.Item label="所在部门">
									{getFieldDecorator('department',)(
										<Select allowClear placeholder='请输入所在部门'>
												{DepartmentList.map(item=><Option value={item.id}>{item.name}</Option>)}
										</Select>)}
								</Form.Item>
						</Col> */}
						<Col span={4}>
							<Button type="primary" onClick={()=>{this.TableSearchPeo()}}>查询</Button>
						</Col>
					</Row>
					</Form>	
						<Table columns={columnPeo} dataSource={peopleData} pagination={false} loading={loadingTable}  rowSelection={rowSelectionTablePeo} rowKey={(record, index) => record.id} />
						<Paging total={totalTablePeo} formValues={formValuesTablePeo} fetch={pager => this.fetchTablePeo(pager)} />
				</Modal>
				<Modal {...modalProps}>
					<Form  {... {labelCol: {xs: { span: 30 },sm: { span:6 },},wrapperCol: {xs: {span: 24},sm: {span: 14}}}}>
					<Row gutter={24}>
						<Col span={10}>
								<Form.Item label="设备类别">
									{getFieldDecorator('equipmentTypeNameId')(
										<TreeSelect onChange={this.onTreeChange} placeholder={'请选择设备类别'} showCheckedStrategy="SHOW_PARENT" treeCheckable={false}  allowClear>
										{this.renderTreeNodes(EquTypePageList, 'name', 'id')}
										</TreeSelect>)}
								</Form.Item>
						</Col>
						{/* <Col span={10}>
								<Form.Item label="所在部门">
									{getFieldDecorator('depId',)(
										<Select allowClear placeholder='请输入所在部门'>
												{DepartmentList.map(item=><Option value={item.id}>{item.name}</Option>)}
										</Select>)}
								</Form.Item>
						</Col> */}
						<Col span={4}>
							<Button type="primary" onClick={()=>{this.TableSearch()}}>查询</Button>
						</Col>
					</Row>
					</Form>	
						<Table columns={column} dataSource={p.state.tableData} pagination={false} loading={loadingTable}  rowSelection={rowSelectionTable} rowKey={(record, index) => record.id}  childrenColumnName={''} />
						<Paging total={totalTable} formValues={formValuesTable} fetch={pager => this.fetchTable(pager)} />
				</Modal>
				{/* <BasicDrawers {...drawerProps} /> */}
				<div style={{width:'100%'}}>
					<div >
					<Form {...{ labelCol: { xs: { span: 6 }, sm: { span: 8},},	wrapperCol: { xs: { span: 12 }, sm: { span: 16 }, }}}>
						<h2 style={{fontSize:16,color:'#0067B8',fontWeight:600}}>基本信息</h2>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col span={6}>

								<Form.Item label="维修单号">
								{getFieldDecorator('repairOrderNum', {
									// rules: [{	required: true,	message: '请填写承运单号'}]
								})(<Input allowClear placeholder='不填可自动生成' disabled={true}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="设备编号">
								{getFieldDecorator('equipmentNum', {
									// rules: [{	required: true,	message: '请填写承运单号'}]
								})(<Input allowClear placeholder='请输入设备编号' disabled={true}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="设备名称">
								{getFieldDecorator('equipmentName',{	
									// rules: [{	required: true,	message: '请选择起始地'}]
								})(
									<Input allowClear placeholder='请输入设备名称' disabled={true}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="设备类别">
									{getFieldDecorator('equipmentTypeName')(
									// <TreeSelect onChange={this.onTreeChange} placeholder={'请选择设备类别'} showCheckedStrategy="SHOW_PARENT" treeCheckable={false}  allowClear>
									// {this.renderTreeNodes(EquTypePageList, 'name', 'id')}
									// </TreeSelect>)}
									<Input allowClear placeholder='请输入设备类别' disabled={true}/>)}
								</Form.Item>
							</Col>
						</Row>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col span={6}>
								<Form.Item label="规格型号">
									{getFieldDecorator('specificationAndModule',)(
									<Input allowClear placeholder='请输入规格型号' disabled={true}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="所在部门">
									{getFieldDecorator('dept',)(
									// <Select allowClear placeholder='请输入所在部门'>
									// 		{DepartmentList.map(item=><Option value={item.id}>{item.name}</Option>)}
									// </Select>)}
											<Input allowClear placeholder='请输入所在部门' disabled={true}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="设备位置">
									{getFieldDecorator('equipmentLocation')(<Input allowClear placeholder='请输入设备位置' disabled={true}/>)}
								</Form.Item>
							</Col>
							{/* <Col span={6}>
								<Button type="primary" onClick={()=>{this.chooseEqu()}} >选择设备</Button>
							</Col> */}
						</Row>
						<h2 style={{fontSize:16,color:'#0067B8',fontWeight:600}}>故障信息</h2>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col span={6}>
								<Form.Item label="报修单号">
									{getFieldDecorator('repairOrderNum')(<Input allowClear placeholder='请输入报修单号' disabled={true}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="发生时间">
									{getFieldDecorator('occurrenceTime')(<Input allowClear placeholder='请输入发生时间' disabled={true}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="报修时间">
									{getFieldDecorator('repairTime')(<Input allowClear placeholder='请输入报修时间' disabled={true}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="报修人" >
									{getFieldDecorator('repairMan',)(<Input allowClear placeholder='请输入报修人'disabled={true}/>)}
								</Form.Item>
							</Col>
						</Row>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col span={6}>
								<Form.Item label="故障部位">
								{getFieldDecorator('positionId')(<Select allowClear placeholder='请输入设备部位'>
										{sbbw.map(item=><Option value={item.id}>{item.name}</Option>)}
									</Select>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="故障类别">
								{getFieldDecorator('faultCategory')(<TreeSelect onChange={this.onTreeChange} placeholder={'请选择故障类别'} showCheckedStrategy="SHOW_PARENT" treeCheckable={false}  allowClear>
									{this.renderTreeNodes(gzlb, 'name', 'id')}
									</TreeSelect>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="故障等级">
								{getFieldDecorator('faultLevel')(<Select allowClear placeholder='请输入故障等级'>
										{gzdj.map(item=><Option value={item.id}>{item.configValue}</Option>)}
									</Select>)}
								</Form.Item>
							</Col>
						</Row>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col span={6}>
								<Form.Item label="故障描述">
									{getFieldDecorator('faultDescription')(<TextArea allowClear placeholder='请输入故障描述'style={{width:460,height:80}}/>)}
								</Form.Item>
							</Col>
							{/* <Col span={6}>
								<Form.Item label="故障语音">
									{getFieldDecorator('faultDescription')(<TextArea allowClear placeholder='请输入故障描述'/>)}
								</Form.Item>
							</Col> */}
						</Row>
						<h2 style={{fontSize:16,color:'#0067B8',fontWeight:600}}>处理情况</h2>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col span={6}>
								<Form.Item label="故障原因">
									{getFieldDecorator('repairCause')(<Select allowClear placeholder='请输入故障原因'>
											{gzyy.map(item=><Option value={item.id}>{item.configValue}</Option>)}
									</Select>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="维修组">
									{getFieldDecorator('maintenanceTeam')(<Select allowClear placeholder='请输入维修组'>
											{wxz.map(item=><Option value={item.id}>{item.name}</Option>)}
									</Select>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="维修状态">
									{getFieldDecorator('repairStatus',{initialValue:158})(<Select allowClear placeholder='请输入维修状态' disabled={true}>
											{wxzt.map(item=><Option value={item.id}>{item.configValue}</Option>)}
									</Select>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="维修级别">
									{getFieldDecorator('maintenanceLevel')(<Select allowClear placeholder='请输入维修级别'>
											{wxjb.map(item=><Option value={item.id}>{item.configValue}</Option>)}
									</Select>)}
								</Form.Item>
							</Col>
						</Row>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col span={6}>
								<Form.Item label="维修类别">
									{getFieldDecorator('maintenanceCategory')(<Select allowClear placeholder='请输入维修类别'>
											{wxlb.map(item=><Option value={item.id}>{item.configValue}</Option>)}
									</Select>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="紧急程度">
								{getFieldDecorator('urgency')(<Select allowClear placeholder='请输入紧急程度'>
										{jjcd.map(item=><Option value={item.id}>{item.configValue}</Option>)}
								</Select>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="是否停机">
								{getFieldDecorator('isStop', { valuePropName: 'checked' })(<Switch onChange={this.SwitchOnChange}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="停机时长">
									{getFieldDecorator('downtime')(<Input allowClear placeholder="默认单位为分钟" disabled={this.state.switchChecked ? false : true} />)}
								</Form.Item>
							</Col>
						</Row>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col  span={6} >
								<Form.Item label="开始时间">
									{getFieldDecorator('dateSec_maintenanceStartTime')(<DatePicker allowClear placeholder='请输入开始时间' onChange={this.dateonChangeStart} disabled={chooseData.status===8 ? true : false} format="YYYY-MM-DD HH:mm"
      									disabledDate={this.disabledDate}
										 />)}
								</Form.Item>
							</Col>
							<Col  span={6} >
								<Form.Item label="结束时间">
									{getFieldDecorator('dateSec_maintenanceEndTime')(<DatePicker allowClear placeholder='请输入结束时间' onChange={this.dateonChangeEnd}  format="YYYY-MM-DD HH:mm"
      									disabledDate={this.handleEndDisabledDate}
										 disabled={this.state.dateEndDisabeld}/>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<FormItem label="维修用时">
									{/* wu 'maintenanceTime'*/}
									<Form.Item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}>
										{getFieldDecorator('hours',{initialValue:0})(<InputNumber style={{width:60}}/>)}<span> 时 </span>
									</Form.Item>
									<Form.Item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}>
										{getFieldDecorator('miuntes',{initialValue:0})(<InputNumber style={{width:60}}/>)}<span> 分 </span>
									</Form.Item>
								</FormItem>
							</Col>
							
							<Col span={6}>
								<Form.Item label="维修费用">
									{getFieldDecorator('maintenanceCosts')(<InputNumber style={{width:184}} allowClear placeholder='请输入维修费用'/>)}
								</Form.Item>
							</Col>
						</Row>
						<Row gutter={24} style={{width:1200,margin:'0 auto'}}>
							<Col span={6}>
								<Form.Item label="外委单位">
									{/* wu */}
									{getFieldDecorator('outsourcingUnit')(<Select allowClear placeholder='请输入外委单位'>
										{wwdw.map(item=><Option value={item.id}>{item.name}</Option>)}
									</Select>)}
								</Form.Item>
							</Col>
							<Col span={6}>
								<Form.Item label="工作描述">
									{getFieldDecorator('workDescription')(<TextArea allowClear placeholder='请输入工作描述'style={{width:460,height:80}}/>)}
								</Form.Item>
							</Col>
						</Row>
						
					</Form>
						<h2 style={{fontSize:16,color:'#0067B8',fontWeight:600}}>维修工作量</h2>
						<div style={{width:'100%'}}>
							<div style={{width:1200,margin:'0 auto'}}>
								{/* <Button icon="plus" type="primary" onClick={this.choosePeo}>添加人员</Button> */}
								<Table columns={columns} rowKey={(record, index) => index} dataSource={equipmentRepairWorkAddDTOList} pagination={false} loading={this.state.datePickerLoading} scroll={{ y: 450 ,x:1200}} />
							</div>
						</div>
						{/* <h2 style={{fontSize:16,color:'#0067B8',fontWeight:600}}>更换备件</h2> */}
						{/* <Paging total={total} formValues={formValues} fetch={pager => this.fetch(pager)} /> */}
						{/* <Table columns={columns1} rowSelection={rowSelection} rowKey={(record, index) => index} dataSource={dataSource1} pagination={false} loading={loading} scroll={{ y: 250 }} /> */}
						{/* <Paging total={total} formValues={formValues} fetch={pager => this.fetch(pager)} /> */}
						<div style={{width:'100%',marginTop:100}}>
							<div style={{margin:'0 auto',width:'400px'}}>
								{/* <Button icon="check" onClick={this.lastOperateIsChoose} type="primary" style={{marginRight: 38,}}>保存</Button> */}
								<Button onClick={()=>{this.props.history.push('/MaintenanceRecords')}} icon="close">返回</Button>
							</div>
						</div>
					</div>
				</div>
				</Spin>
			</div>
		 );
	 }
 }
 export default Form.create()(withRouter(App));
 